package org.ims.inv.web.action.index;

import java.math.BigInteger;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.ims.inv.web.action.BaseAppAction;

/**
 * Action: 管理首页
 * 
 * @author Jeccy.Zhao
 *
 */
public class IndexAction
extends BaseAppAction
{
	/**
	 * The LOGGER
	 */
	private static final Logger LOGGER = Logger.getLogger(IndexAction.class);

	/**
	 * <b>[WebAction]</b> 
	 * <br/>
	 * The index presentation page action.
	 */
	public ActionForward index (ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) 
	{
		// initialization.
		init(request);
		
		return mapping.findForward("index");
	}
	
	/**
	 * Initialization for current logon user
	 * 
	 * @param request
	 */
	private void init(HttpServletRequest request)
	{
		// 待提交材料数量
		BigInteger numProjectForPost = this.getNumProjectForPost();
		request.setAttribute("numProjectForPost", numProjectForPost);
		
		// 审批中
		BigInteger numProjectForApproving = this.getNumProjectForApproving();
		request.setAttribute("numProjectForApproving", numProjectForApproving);
		
		// 审批退回
		BigInteger numProjectForReturned = this.getNumProjectForReturn();
		request.setAttribute("numProjectForReturned", numProjectForReturned);
		
		// 初审
		BigInteger numProjectForTrailAudit = this.getNumProjectForTrailAudit();
		request.setAttribute("numProjectForTrailAudit", numProjectForTrailAudit);
		
		// 复审
		BigInteger numProjectForReviewAudit = this.getNumProjectForReviewAudit();
		request.setAttribute("numProjectForReviewAudit", numProjectForReviewAudit);
		
		// 项目分配
		BigInteger numProjectForAllocate = this.getNumProjectForAllocate();
		request.setAttribute("numProjectForAllocate", numProjectForAllocate);
		
		// 过会
		BigInteger numProjectForConference = this.getNumProjectForConference();
		request.setAttribute("numProjectForConference", numProjectForConference);
		
		// 过会预审
		BigInteger numProjectForConferencePreAudit = this.getNumProjectForConferenceAudit();
		request.setAttribute("numProjectForConferencePreAudit", numProjectForConferencePreAudit);
		
		// 会议审批
		BigInteger numConferenceAudit = this.getNumConferenceAudit();
		request.setAttribute("numConferenceAudit", numConferenceAudit);
	}
	
	public static Logger getLogger()
	{
		return LOGGER;
	}

}
